// ml:run = $bin < input
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

struct data
{
    std::string s;
    int l;
};

bool operator<(data const& a, data const& b)
{
    return a.l < b.l;
}

int n, k;
std::string right;
std::vector<data> da;

int less(int len)
{
    int ret = 0;
    for (int i = 0; i < n; i++) {
        if ((int)da[i].s.size() >= len) return ret;
        ret++;
    }
    return ret;
}

int calc(int x)
{
    int ret = ((x - 1) / k) * 5;
    ret += x;
    return ret;
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin >> n >> k;
    da.resize(n);
    for (int i = 0; i < n; i++) {
        std::cin >> da[i].s;
        da[i].l = da[i].s.size();
    }
    std::cin >> right;
    std::sort(da.begin(), da.end());
    int good = less(right.size()) + 1;
    int bad = less(right.size() + 1);
    std::cout << calc(good) << " " << calc(bad) << "\n";
}

